<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta name="format-detection" content="telephone=no" />
    <title>业务管理系统-系统管理-机构管理</title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <link rel="stylesheet" href="/css/style.css" />
    <link rel="stylesheet" href="/css/iconfont.css" />
    <link rel="stylesheet" href="/css/element-icons.css" />
    <link rel="stylesheet" href="/css/newiconfont.css" />
    <script src="/js/jquery.min.js"></script>
    <script src="/js/lib.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!--[if IE]>
    <link rel="stylesheet" href="/css/all-ie-only.css" />
    <![endif]-->
</head>

<body>
<div class="header">
    <a href="javascript:;" class="header-logo">
        <img src="/images/logo.png" alt="" />
    </a>
    <div class="header-nav">
        <ul class="fix">
            <li>
                <a href="javascript:;" class="v1">标识注册系统</a>
            </li>
            <li>
                <a href="javascript:;" class="v1">标识解析系统</a>
            </li>
            <li>
                <a href="javascript:;" class="v1">统一认证系统</a>
            </li>
            <li>
                <a href="javascript:;" class="v1">运行检测系统</a>
            </li>
            <li>
                <a href="javascript:;" class="v1">区块链浏览器</a>
            </li>
            <li>
                <a href="javascript:;" class="v1">链网展示系统</a>
            </li>
        </ul>
    </div>
    <div class="header-user">
        <a href="javascript:;" class="hd">
            <img src="/images/head.png" alt="" />
            <span>管理员</span>
        </a>
        <div class="dropdown-menu">
            <div class="icon-arrow"></div>
            <ul>
                <li class="wrz">
                    <a href="javascript:;" class="con">
                        <span>未认证</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:;" class="con">
                        <span>首页</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:;" class="con">
                        <span>资料编辑</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:;" class="con">
                        <span>我的钱包</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:;" class="con">
                        <span>退出</span>
                    </a>
                </li>
            </ul>
        </div>
    </div>
</div>
<div class="block-contail">
    <!-- 布局-侧边 -->
    <div class="block-left">
        <div class="block-scrollbar">
            <!-- 收起、展开按钮 -->
            <div class="arrow-btn">
                <span class="el-icon-arrow-left"></span>
            </div>
            <!-- 收起、展开按钮 end -->
            <!-- 侧边导航 -->
            <ul class="slide-nav">
                <li>
                    <a href="javascript:;" class="v1">
                        <i class="icon_dn icon newiconfont newicon1-guganlianguanli"></i>
                        <span class="title">骨干链管理</span>
                        <i class="icon-arrow el-icon-arrow-down"></i>
                    </a>
                    <div class="slide-nav-subitem">
                        <ul>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">基础配置</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">节点管理</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">合约管理</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">用户管理</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </li>
                <li>
                    <a href="javascript:;" class="v1">
                        <i class="icon_dn icon newiconfont newicon2-zilianguanli"></i>
                        <span class="title">子链管理</span>
                        <i class="icon-arrow el-icon-arrow-down"></i>
                    </a>
                    <div class="slide-nav-subitem">
                        <ul>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">子链申报管理</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">子链区块头</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">子链节点管理</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">子链用户管理</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">子链合约管理</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </li>
                <li>
                    <a href="javascript:;" class="v1">
                        <i class="icon_dn icon newiconfont newicon3-renzhengzhongxin"></i>
                        <span class="title">认证中心</span>
                        <i class="icon-arrow el-icon-arrow-down"></i>
                    </a>
                    <div class="slide-nav-subitem">
                        <ul>
                            <li>
                                <a href="/manage/authentication/certificateperson.html" class="v2">
                                    <span class="title">个人认证</span>
                                </a>
                            </li>
                            <li>
                                <a href="/manage/authentication/certificatecorp.html" class="v2">
                                    <span class="title">企业认证</span>
                                </a>
                            </li>
                            <li>
                                <a href="/manage/authentication/certificatenode.html" class="v2">
                                    <span class="title">节点认证</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </li>
                <li>
                    <a href="javascript:;" class="v1">
                        <i class="icon_dn icon newiconfont newicon6-quanxianguanli"></i>
                        <span class="title">权限管理</span>
                        <i class="icon-arrow el-icon-arrow-down"></i>
                    </a>
                    <div class="slide-nav-subitem">
                        <ul>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">角色管理</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </li>
                <li>
                    <a href="javascript:;" class="v1">
                        <i class="icon_dn icon iconfont iconicon_setting"></i>
                        <span class="title">系统管理</span>
                        <i class="icon-arrow el-icon-arrow-down"></i>
                    </a>
                    <div class="slide-nav-subitem">
                        <ul>
                            <li>
                                <a href="/manage/system/user.html" class="v2">
                                    <span class="title">用户管理</span>
                                </a>
                            </li>
                            <li>
                                <a href="/manage/system/dictbiz.html" class="v2">
                                    <span class="title">系统字典</span>
                                </a>
                            </li>
                            <li>
                                <a href="/manage/system/dictbiz.html" class="v2">
                                    <span class="title">业务字典</span>
                                </a>
                            </li>
                            <li>
                                <a href="/manage/system/menu.html" class="v2">
                                    <span class="title">菜单管理</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </li>
            </ul>
            <!-- 侧边导航 end -->
        </div>
    </div>
    <!-- 布局-侧边 end -->
    <!-- 布局-主内容 -->
    <div class="block-main">
        <div class="block-scrollbar">
            <!-- 主内容 -->
            <div class="block-2">
                <div class="block2-cont">
                    <div class="box-set5">
                        <div class="set-bd2">
                            <div class="set-item col-3">
                                <div class="tit">机构名称:</div>
                                <div class="con">
                                    <input id="deptName" type="text" class="input-inner" placeholder="机构名称" />
                                </div>
                            </div>
                            <div class="set-item col-3">
                                <div class="tit">所属租户:</div>
                                <div class="con">
                                    <div class="dropmenurel01 js-dropmenu" data-modulename="dropmenurel01">
                                        <input type="hidden" value="" id="tenantId">
                                        <div class="dropmenurel01-tit">
                                            <span id="tenantName">所属租户</span>
                                            <i class="el-input__icon el-icon-arrow-up"></i>
                                        </div>
                                        <div class="dropmenurel01-options js-dropmenu-options">
                                            <i class="popper__arrow"></i>
                                            <ul id="select">
                                                <div class="input">
                                                    <input type="text" class="input-inner"
                                                           placeholder="输入关键字进行过滤" />
                                                </div>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="set-item col-3">
                                <div class="tit">机构全称:</div>
                                <div class="con">
                                    <input id="fullName" type="text" class="input-inner" placeholder="机构全称" />
                                </div>
                            </div>
                        </div>
                        <div class="set-bt set-bt_r">
                            <a href="javascript:;" class="primary-btn" id="search">
                                <i class="icon_dn el-icon-search"></i>
                                <span>搜索</span>
                            </a>
                            <a href="javascript:;" id="reset">
                                <i class="icon_dn el-icon-delete"></i>
                                <span>清空</span>
                            </a>
                        </div>
                    </div>
                    <div class="box-set6">
                        <div class="set-bt3">
                            <div id="refresh" class="item">
                                <a href="javascript:;" class="btn">
                                    <i class="el-icon-refresh"></i>
                                </a>
                                <div class="mask">
                                    <div class="popper__arrow"></div>
                                    <div class="tit">刷新</div>
                                </div>
                            </div>
                            <!--<div class="item myfancy" data-href="#pop-xianyin">
                                <a href="javascript:;" class="btn">
                                    <i class="el-icon-s-operation"></i>
                                </a>
                                <div class="mask">
                                    <div class="popper__arrow"></div>
                                    <div class="tit">显隐</div>
                                </div>
                            </div>-->
                            <div class="item js_search_show_hide">
                                <a href="javascript:;" class="btn">
                                    <i class="el-icon-search"></i>
                                </a>
                                <div class="mask">
                                    <div class="popper__arrow"></div>
                                    <div class="tit">搜索</div>
                                </div>
                            </div>
                        </div>
                        <div class="set-bt">
                            <a href="javascript:;" class="primary-btn myfancy" data-href="#pop-juesexinzeng">
                                <i class="icon_dn el-icon-plus"></i>
                                <span>新 增</span>
                            </a>
                            <a id="batch_delete" href="javascript:;" class="del-btn myfancy" data-href="#pop-shanchu3">
                                <i class="icon_dn el-icon-delete"></i>
                                <span>删 除</span>
                            </a>
                        </div>
                    </div>
                    <div class="data-content_2 table-scroll-x js-custom-radio-checkbox" data-modulename="formrel01">
                        <div class="table1-head table-6">
                            <table>
                                <thead>
                                <tr>
                                    <th class="" width="5%">
                                        <div class="checkbox-item">
                                            <label><input type="checkbox" name="allCheckbox" onclick="selectAll();"/></label>
                                        </div>
                                    </th>
                                    <th class="table1_center" width="5%">#</th>
                                    <th>机构名称</th>
                                    <th>所属租户</th>
                                    <th>机构全称</th>
                                    <th>上级机构</th>
                                    <th>机构类型</th>
                                    <th>排序</th>
                                    <th>备注</th>
                                    <th class="table1_center">操作</th>
                                </tr>
                                </thead>
                                <tbody id="table"></tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 角色-新增 -->
            <div class="m-pop" id="pop-juesexinzeng">
                <div class="win-pop4">
                    <div class="win1-hd">
                        <div class="win1-btn">
                            <a href="javascript:;" class="fullscreen js-fullscreen">
                                <i class="el-icon-full-screen"></i>
                            </a>
                            <a href="javascript:;" class="close js-close">
                                <i class="el-icon-close"></i>
                            </a>
                        </div>
                        <h3>新 增</h3>
                    </div>
                    <div class="win3-bd">
                        <div class="form-1 form-5">
                            <form action="">
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>机构名称:</div>
                                    <div class="con">
                                        <input id="deptName_add" type="text" class="input-inner" placeholder="请输入机构名称" value="">
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>机构全称:</div>
                                    <div class="con">
                                        <input id="fullName_add" type="text" class="input-inner" placeholder="请输入机构全称" value="">
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>上级机构:</div>
                                    <div class="con">
                                        <input id="parentId_add" type="hidden">
                                        <input id="parentName_add" type="text" class="input-inner" placeholder="请选择上级机构" value="" readonly onclick="initDeptTree('add');">
                                        <ul id="ztreeDiv_add" class="ztree" style="display: none;"></ul>
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>机构类型:</div>
                                    <div class="con">
                                        <select id="category_add" style="height: 38px;line-height: 38px;width: 100%;border:1px solid #dcdfe6;vertical-align:middle;">
                                            <option value="">请选择机构类型</option>
                                            <option value="1">公司</option>
                                            <option value="2">部门</option>
                                            <option value="3">小组</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>排序:</div>
                                    <div class="con">
                                        <input id="sort_add" type="number" class="input-inner" placeholder="请输入排序" value="">
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit">备注:</div>
                                    <div class="con">
                                        <input id="remark_add" type="text" class="input-inner" placeholder="请输入备注" value="">
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="win-bt2">
                        <a href="javascript:;" class="primary-btn" onclick="submitForm('add')"><span><i
                                class="icon_dn el-icon-circle-close"></i>保存</span></a>
                        <a href="javascript:;" class="js-btn"><span><i
                                class="icon_dn el-icon-circle-plus-outline"></i>取消</span></a>
                    </div>
                </div>
            </div>
            <!-- 角色-新增 end -->
            <!-- 角色-查看 -->
            <div class="m-pop" id="pop-juesechakan">
                <div class="win-pop4">
                    <div class="win1-hd">
                        <div class="win1-btn">
                            <a href="javascript:;" class="fullscreen js-fullscreen">
                                <i class="el-icon-full-screen"></i>
                            </a>
                            <a href="javascript:;" class="close js-close">
                                <i class="el-icon-close"></i>
                            </a>
                        </div>
                        <h3>查 看</h3>
                    </div>
                    <div class="win3-bd">
                        <div class="form-1 form-5">
                            <form action="">
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>机构名称:</div>
                                    <div class="con">
                                        <input id="deptName_view" type="text" class="input-inner" placeholder="请输入机构名称" value="" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>所属租户:</div>
                                    <div class="con">
                                        <input id="tenantId_view" type="text" class="input-inner" placeholder="请输入机构全称" value="管理组" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>机构全称:</div>
                                    <div class="con">
                                        <input id="fullName_view" type="text" class="input-inner" placeholder="请输入机构全称" value="" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>上级机构:</div>
                                    <div class="con">
                                        <input id="parentName_view" type="text" class="input-inner" placeholder="请选择上级机构" value="" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>机构类型:</div>
                                    <div class="con">
                                        <input id="deptCategoryName_view" type="text" class="input-inner" placeholder="请选择上级机构" value="" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>排序:</div>
                                    <div class="con">
                                        <input id="sort_view" type="number" class="input-inner" placeholder="请输入排序" value="" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit">备注:</div>
                                    <div class="con">
                                        <input id="remark_view" type="text" class="input-inner" placeholder="请输入备注" value="" disabled>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 角色-查看 end -->
            <!-- 角色-编辑 -->
            <div class="m-pop" id="pop-juesebianji">
                <div class="win-pop4">
                    <div class="win1-hd">
                        <div class="win1-btn">
                            <a href="javascript:;" class="fullscreen js-fullscreen">
                                <i class="el-icon-full-screen"></i>
                            </a>
                            <a href="javascript:;" class="close js-close">
                                <i class="el-icon-close"></i>
                            </a>
                        </div>
                        <h3>编 辑</h3>
                    </div>
                    <div class="win3-bd">
                        <div class="form-1 form-5">
                            <form action="">
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>机构名称:</div>
                                    <div class="con">
                                        <input id="deptName_edit" type="text" class="input-inner" placeholder="请输入机构名称" value="">
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>机构全称:</div>
                                    <div class="con">
                                        <input id="fullName_edit" type="text" class="input-inner" placeholder="请输入机构全称" value="">
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>上级机构:</div>
                                    <div class="con">
                                        <input id="parentId_edit" type="hidden">
                                        <input id="parentName_edit" type="text" class="input-inner" placeholder="请选择上级机构" value="" readonly onclick="initDeptTree('edit');">
                                        <ul id="ztreeDiv_edit" class="ztree" style="display: none;"></ul>
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>机构类型:</div>
                                    <div class="con">
                                        <select id="category_edit" style="height: 38px;line-height: 38px;width: 100%;border:1px solid #dcdfe6;vertical-align:middle;">
                                            <option value="">请选择机构类型</option>
                                            <option value="1">公司</option>
                                            <option value="2">部门</option>
                                            <option value="3">小组</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>排序:</div>
                                    <div class="con">
                                        <input id="sort_edit" type="number" class="input-inner" placeholder="请输入排序" value="">
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit">备注:</div>
                                    <div class="con">
                                        <input id="remark_edit" type="text" class="input-inner" placeholder="请输入备注" value="">
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="win-bt2">
                        <a href="javascript:;" class="primary-btn" onclick="submitForm('edit')"><span><i
                                class="el-icon-circle-check"></i>修改</span></a>
                        <a href="javascript:;" class="js-btn"><span><i
                                class="el-icon-circle-close"></i>取消</span></a>
                    </div>
                </div>
            </div>
            <div class="m-pop" id="pop-tianjiazx">
                <div class="win-pop4">
                    <div class="win1-hd">
                        <div class="win1-btn">
                            <a href="javascript:;" class="fullscreen js-fullscreen">
                                <i class="el-icon-full-screen"></i>
                            </a>
                            <a href="javascript:;" class="close js-close">
                                <i class="el-icon-close"></i>
                            </a>
                        </div>
                        <h3>添加子项</h3>
                    </div>
                    <div class="win3-bd">
                        <div class="form-1 form-5">
                            <form action="">
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>机构名称:</div>
                                    <div class="con">
                                        <input id="deptName_zx" type="text" class="input-inner" placeholder="请输入机构名称" value="">
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>机构全称:</div>
                                    <div class="con">
                                        <input id="fullName_zx" type="text" class="input-inner" placeholder="请输入机构全称" value="">
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>上级机构:</div>
                                    <div class="con">
                                        <input id="parentId_zx" type="hidden">
                                        <input id="parentName_zx" type="text" class="input-inner" placeholder="请选择上级机构" value="" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>机构类型:</div>
                                    <div class="con">
                                        <select id="category_zx" style="height: 38px;line-height: 38px;width: 100%;border:1px solid #dcdfe6;vertical-align:middle;">
                                            <option value="">请选择机构类型</option>
                                            <option value="1">公司</option>
                                            <option value="2">部门</option>
                                            <option value="3">小组</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>排序:</div>
                                    <div class="con">
                                        <input id="sort_zx" type="number" class="input-inner" placeholder="请输入排序" value="">
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit">备注:</div>
                                    <div class="con">
                                        <input id="remark_zx" type="text" class="input-inner" placeholder="请输入备注" value="">
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="win-bt2">
                        <a href="javascript:;" class="primary-btn" onclick="submitForm('zx')"><span><i class="el-icon-circle-check"></i>添加</span></a>
                        <a href="javascript:;" class="js-btn"><span><i class="el-icon-circle-close"></i>取消</span></a>
                    </div>
                </div>
            </div>
            <!-- 角色-编辑 end -->
            <!-- 权限设置 -->
            <div class="m-pop" id="pop-quanxianshezhi">
                <div class="win-pop7">
                    <div class="win1-hd">
                        <div class="win1-btn">
                            <a href="javascript:;" class="close js-close">
                                <i class="el-icon-close"></i>
                            </a>
                        </div>
                        <h3>角色权限配置</h3>
                    </div>
                    <div class="win3-bd">
                        <div class="tabrel04 js-tabs js-anim" data-modulename="tabrel04">
                            <ul class="tabrel04-tit">
                                <li class="tabrel04-item tabrel04-item__on"><span class="subitem">菜单权限</span></li>
                                <li class="tabrel04-item"><span class="subitem">数据权限</span></li>
                                <li class="tabrel04-item"><span class="subitem">接口权限</span></li>
                            </ul>
                            <div class="tabrel04-desc">
                                <div class="tabrel04-item tabrel04-item__on">
                                    <div class="tree-ul js_tree js-custom-radio-checkbox"
                                         data-modulename="formrel01">
                                        <ul id="menuScope"></ul>
                                    </div>
                                </div>
                                <div class="tabrel04-item">
                                    <div class="tree-ul js_tree js-custom-radio-checkbox"
                                         data-modulename="formrel01">
                                        <ul id="dataScope"></ul>
                                    </div>
                                </div>
                                <div class="tabrel04-item">
                                    <div class="tree-ul js_tree js-custom-radio-checkbox"
                                         data-modulename="formrel01">
                                        <ul id="apiScope"></ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="win-bt2">
                        <a href="javascript:;" class="js-btn"><span>取消</span></a>
                        <a href="javascript:;" class="primary-btn" onclick="sumbitPermission()"><span>确定</span></a>
                    </div>
                </div>
            </div>
            <!-- 权限设置 end -->
            <!-- 主内容 end -->
        </div>
    </div>
    <!-- 布局-主内容 end -->
</div>
<div class="pop-bg"></div>
<!-- 合约禁用弹窗 -->
<div class="m-pop" id="pop-heyuejinyong">
    <div class="win-pop1">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>合约禁用</h3>
        </div>
        <div class="win1-bd">
            <div class="win1-item">
                <div class="tit">禁用原因<span>*</span></div>
                <div class="con">
                    <input type="text" class="input-inner" />
                </div>
            </div>
        </div>
        <div class="win-bt">
            <a href="javascript:;" class="js-btn"><span>取 消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确 定</span></a>
        </div>
    </div>
</div>
<!-- 合约禁用弹窗 end -->
<!-- 撤销弹窗 -->
<div class="m-pop" id="pop-chexiaozhengshu">
    <div class="win-pop1">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>撤销</h3>
        </div>
        <div class="win1-bd">
            <div class="win1-item">
                <div class="tit">撤销原因:</div>
                <div class="con">
                    <textarea class="textarea-inner" placeholder="请输入撤销原因"></textarea>
                </div>
            </div>
        </div>
        <div class="win-bt">
            <a href="javascript:;" class="primary-btn"><span>提交</span></a>
            <a href="javascript:;" class="js-btn"><span>返回</span></a>
        </div>
    </div>
</div>
<!-- 撤销弹窗 end -->
<!-- 禁用弹窗 -->
<div class="m-pop" id="pop-jinyong">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-info"></div>
                <div class="desc">
                    <p>您确定要禁用标识吗？</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 禁用弹窗 end -->
<!-- 启用弹窗 -->
<div class="m-pop" id="pop-qiyong">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-info"></div>
                <div class="desc">
                    <p>您确定要启用标识吗？</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 启用弹窗 end -->
<!-- 下载KeyStore -->
<div class="m-pop" id="pop-xiazaiKeyStore">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="tit">请输入创建人的私钥</div>
                <div class="con">
                    <input type="text" class="input-inner" />
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 下载KeyStore end -->
<!-- 删除 -->
<div class="m-pop" id="pop-shanchu">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-warning"></div>
                <div class="desc">
                    <p>此操作将永久删除该数据, 是否继续?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 删除 end -->
<!-- 删除2 -->
<div class="m-pop" id="pop-shanchu2">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-info"></div>
                <div class="desc">
                    <p>确定删除选中角色?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 删除2 end -->
<!-- 删除3 -->
<div class="m-pop" id="pop-shanchu3">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-warning"></div>
                <div class="desc">
                    <p>确定将选择数据删除?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn" onclick="deleteRole('3')"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 删除3 end -->
<!-- 删除4 -->
<div class="m-pop" id="pop-shanchu4">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-warning"></div>
                <div class="desc">
                    <p>确定将选择数据删除?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn" onclick="deleteRole('4')"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 删除4 end -->
<!-- 移至黑名单 -->
<div class="m-pop" id="pop-yizhiheimingdan">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-warning"></div>
                <div class="desc">
                    <p>确定将该用户移至黑名单吗?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 移至黑名单 end -->
<!-- 升至管理员 -->
<div class="m-pop" id="pop-shengzhiguanliyuan">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-warning"></div>
                <div class="desc">
                    <p>确定将该用户添加至管理员?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 升至管理员 end -->
<!-- 移除管理员 -->
<div class="m-pop" id="pop-yichuguanliyuan">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-info"></div>
                <div class="desc">
                    <p>确定移除该用户管理员?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 移除管理员 end -->
<!-- 重置密码 -->
<div class="m-pop" id="pop-chongzhimima">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>请输入接收密码的邮箱</h3>
        </div>
        <div class="win3-bd">
            <div class="form-1 form-4">
                <form action="">
                    <div class="form-item col-1">
                        <div class="tit"></div>
                        <div class="con">
                            <input type="text" class="input-inner" placeholder="">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 重置密码 end -->
<!-- 钱包解锁弹窗 -->
<div class="m-pop" id="pop-qianbaojiesuo">
    <div class="win-pop2">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-dialog__close el-icon el-icon-close"></i>
                </a>
            </div>
            <h3>钱包解锁</h3>
        </div>
        <div class="win1-bd">
            <div class="win2-item">
                <div class="tit">请选择方式：</div>
                <div class="con">
                    <ul class="radio-group js-custom-radio-checkbox" data-modulename="formrel01">
                        <li data-selectName=".item-select1">
                            <label>
                                <input type="radio" name="1" checked />
                                <i class="icon"></i>
                                <span>BID keystore 文件</span>
                            </label>
                        </li>
                        <li data-selectName=".item-select2">
                            <label>
                                <input type="radio" name="1" />
                                <i class="icon"></i>
                                <span>BID私钥</span>
                            </label>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="win2-item item-select1">
                <div class="tit">请选择BID Keystore文件</div>
                <div class="con">
                    <div class="file-upload_box3">
                        <div class="fileUpload-btn3">
                            <label>
                                <input type="file" class="js-upload">
                                <span><i class="icon_dn el-icon-upload e-upload"></i>选择文件</span>
                            </label>
                        </div>
                        <ul class="fileUpload-files">
                            <!-- <li>
                            <a href="javascript:;">
                                <i class="el-icon-document"></i>
                                <span>5cd67b13-740e-4f77-b950-09e47e60881d (1).json</span>
                            </a>
                            <i class="el-icon-close"></i>
                        </li> -->
                        </ul>
                    </div>
                </div>
            </div>
            <div class="win2-item col-1 item-select1">
                <div class="tit">请输入密码：</div>
                <div class="con">
                    <div class="input-suffix">
                        <input type="password" class="input-inner" placeholder="请输入密码" />
                        <div class="icon">
                            <i class="el-input__icon i-changetype el-icon-view"></i>
                            <i class="el-input__icon el-icon-circle-close"></i>
                        </div>
                    </div>
                </div>
            </div>
            <div class="win2-item col-1 item-select2">
                <div class="tit">请输入BID私钥：</div>
                <div class="con">
                    <div class="input-suffix">
                        <input type="password" class="input-inner" placeholder="请输入BID私钥" />
                        <div class="icon">
                            <i class="el-input__icon i-changetype el-icon-view"></i>
                            <i class="el-input__icon el-icon-circle-close"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="win-bt win-bt_center">
            <a href="javascript:;" class="js-btn"><span>取 消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确 定</span></a>
        </div>
    </div>
</div>
<!-- 钱包解锁弹窗 end -->
<!-- 显隐 -->
<div class="m-pop" id="pop-xianyin">
    <div class="win-pop5">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-dialog__close el-icon el-icon-close"></i>
                </a>
            </div>
            <h3>多 选</h3>
        </div>
        <div class="win1-bd">
            <ul class="checkbox-group2 js-custom-radio-checkbox" data-modulename="formrel01">
                <li>
                    <label>
                        <input type="checkbox" name="1" checked />
                        <i class="icon"></i>
                        <span>角色名称</span>
                    </label>
                </li>
                <li>
                    <label>
                        <input type="checkbox" name="1" />
                        <i class="icon"></i>
                        <span>所属租户</span>
                    </label>
                </li>
                <li>
                    <label>
                        <input type="checkbox" name="1" />
                        <i class="icon"></i>
                        <span>角色别名</span>
                    </label>
                </li>
                <li>
                    <label>
                        <input type="checkbox" name="1" />
                        <i class="icon"></i>
                        <span>角色排序</span>
                    </label>
                </li>
            </ul>
        </div>
    </div>
</div>
<!-- 显隐 end -->
<script src="/js/module.js"></script>
<link rel="stylesheet" href="/js/ztree/zTreeStyle/zTreeStyle.css" />
<script src="/js/ztree/jquery.ztree.all.js"></script>
<script>
    var requestUrl = getRequestUrl();
    var currentPage = 1;
    var currentSize = 10;

    var selectList = {};
    var tableData = [];
    // 需要删除的数据
    var removeList=[];
    // 编辑的数据
    var editObj={};
    // 是否选择全部
    var isSelectedAll = false;

    // 服务组
    var selectgroup = function () {
        $request({
            url: requestUrl + '/tenant/select',
        }, function (res) {
            var template = '';
            $.each(res, function(i, x){
                template += "<li onclick='selectChange(" + x.tenantId + ")' data-value='" + x.tenantId + "'>" + x.tenantName + "</li>"
            });
            $('#select').append(template);
            $.each(res, function(i, x){
                selectList[x.tenantId] = x.tenantName;
            })
            getData(0);
        });
    };
    //
    function selectChange(tenantId) {
        console.log("tenantId",tenantId)
    }
    // 展开或者收起
    function switchTree(e){
        var display=$(e).parent().next().children().css('display')
        if(display==='list-item'){
            $(e).parent().next().children().css('display','none')
            $(e).css("transform",'rotate(0deg)')
        }else{
            $(e).parent().next().children().css('display','list-item')
            $(e).css("transform",'rotate(90deg)')
        }
    }
    // 角色权限配置操作树
    function selectChecbox(e){
        if($(e).attr("checked")){
            $(e).attr("checked",false).parent().removeClass("formrel01-chk__checked")
        }else{
            $(e).attr("checked",true).parent().addClass("formrel01-chk__checked")
        }
    }

    // 刷新
    $('#refresh').click(function(){
        getData(0);
    })
    // 搜索
    $('#search').click(function () {
        currentPage = 1;
        getData(0);
    })
    // 清空
    $('#reset').click(function () {
        $('#role').val('');
        $('#roleAlias').val('');
        $('#tenantId').val('');
        $('#tenantName').html('所属租户');
        currentPage = 1;
        getData(0);
    })
    // 权限设置按钮
    $("#permission_set").click(function(){
        var selecteds=[]
        $("input[name='checkbox']:checked").each(function (index, item) {
            console.log("item",$(item).val())
            selecteds.push($(item).val());
        });
        if(selecteds.length===1){
            $('#pop-quanxianshezhi').fadeIn("normal");
            $('.pop-bg').addClass('open');
            getGrantTree();
        }else if(selecteds.length===0){
            alert("至少选择一条数据");
        }else if(selecteds.length>1){
            alert("只能选择一条数据");
        }
    })
    // 批量删除
    $("#batch_delete").click(function(e){
        removeList=[]
        $("input[name='checkbox']:checked").each(function (index, item) {
            removeList.push($(item).val());
        });
    })
    // 查看按钮
    function view(index,e){
        var _id = $(e).attr('data-href');
        $(_id).fadeIn("normal");
        $('.pop-bg').addClass('open');
        var id = tableData[Number(index)].id;
        $request({
            url: requestUrl + '/dept/detail',
            data: {id: id}
        }, function (res) {
            $("#deptName_view").val(res.deptName);
            $("#fullName_view").val(res.fullName);
            $("#parentName_view").val(res.parentName == "顶级" ? "" : res.parentName);
            $("#deptCategoryName_view").val(res.deptCategoryName);
            $("#sort_view").val(res.sort);
            $("#remark_view").val(res.remark);
        });
    }
    // 编辑按钮
    function edit(index,e){
        var _id = $(e).attr('data-href');
        $(_id).fadeIn("normal");
        $('.pop-bg').addClass('open');
        var id = tableData[Number(index)].id;
        $request({
            url: requestUrl + '/dept/detail',
            data: {id: id}
        }, function (res) {
            editObj = res;
            $("#deptName_edit").val(res.deptName);
            $("#fullName_edit").val(res.fullName);
            $("#sort_edit").val(res.sort);
            $("#remark_edit").val(res.remark);
            $("#category_edit").val(res.deptCategory);
            $("#parentName_view").val(res.parentName == "顶级" ? "" : res.parentName);
        });
    }

    function addzx(index, e){
        var _id = $(e).attr('data-href');
        $(_id).fadeIn("normal");
        $('.pop-bg').addClass('open');
        var id = tableData[Number(index)].id;
        var deptName =  tableData[Number(index)].deptName;
        $("#parentId_zx").val(id);
        $("#parentName_zx").val(deptName);
    }

    // 删除按钮
    function deleteBtn(index,e){
        var detail = tableData[Number(index)]
        var _id = $(e).attr('data-href');
        $(_id).fadeIn("normal");
        $('.pop-bg').addClass('open');
        var id = tableData[Number(index)].id;
        removeList=[id];
    }
    // 选择全部
    function selectAll(){
        if(isSelectedAll){
            $("input[name='checkbox']").each(function(i,item){
                item.checked = false
            })
            isSelectedAll = false
        }else{
            $("input[name='checkbox']").each(function(i,item){
                item.checked = true
            })
            isSelectedAll = true
        }
    }
    // 行checkbox选择
    function selectCheckBox(e){
        if($(e).attr("checked")){
            $(e).attr("checked",false).parent().removeClass("formrel01-chk__checked")
        }else{
            $(e).attr("checked",true).parent().addClass("formrel01-chk__checked")
        }
    }
    // 表格
    var getData = function (parentId) {
        var deptName = $('#deptName').val();
        var fullName = $('#fullName').val();
        var tenantId = $('#tenantId').val();
        $request({
            url: requestUrl + '/dept/lazy-list?parentId=' + parentId,
            data: {
                deptName: deptName,
                fullName: fullName,
                tenantId: tenantId
            }
        }, function (res) {
            tableData = res;
            var template = '';
            $('#table').children().remove();
            $.each(tableData, function(i, x){
                template += "<tr>" +
                    "<td>" +
                    "   <div class='checkbox-item'>" +
                    "       <label><input type='checkbox' name='checkbox' value="+x.id+" onclick='selectCheckBox(this)'/></label>" +
                    "   </div>" +
                    "</td>" +
                    "<td class='table1_center'>" + (i + 1) + "</td>" +
                    (x.hasChildren ? "<td><a href='javascript:void(0);' onclick='queryChildList("+ i + ");'> > </a>" + "&nbsp;" + x.deptName + "</td>" : "<td>" + x.deptName + "</td>") +
                    "<td>" + selectList[x.tenantId] + "</td>" +
                    "<td>" + x.fullName + "</td>" +
                    "<td>" + x.deptCategoryName + "</td>" +
                    "<td>" + x.parentId + "</td>" +
                    "<td>" + x.sort + "</td>" +
                    "<td>" + x.remark + "</td>" +
                    "<td class='table1_center'>" +
                    "   <div class='table1-btn'>" +
                    "       <a href='javascript:;' class='myfancy' data-href='#pop-juesechakan' onclick='view("+i+",this)'><i class='icon_dn el-icon-view'></i>查看</a>" +
                    "       <a href='javascript:;' class='myfancy' data-href='#pop-juesebianji' onclick='edit("+i+",this)'><i class='icon_dn el-icon-edit'></i>编辑</a>" +
                    "       <a href='javascript:;' class='myfancy' data-href='#pop-shanchu4' onclick='deleteBtn("+i+",this)'><i class='icon_dn el-icon-delete'></i>删除</a>" +
                    "       <a href='javascript:;' class='myfancy' data-href='#pop-tianjiazx' onclick='addzx("+i+",this)'><i class='icon_dn el-icon-delete'></i>添加子项</a>" +
                    "   </div>" +
                    "</td>" +
                    "</tr>";
            });
            $('#table').append(template);
        })
    }

    var needQueryId = [];
    function queryChildList(index){
        var needIdArr = [];
        var detail = tableData[Number(index)];
        var id = detail.id;
        var parentId = detail.parentId;
        if($.inArray(id, needQueryId) != -1){
            needIdArr.push(id);
        }else if(parentId != 0 && $.inArray(parentId, needQueryId) != -1){
            needIdArr.push(parentId);
        }
        getData
    }

    // 新增/修改
    function submitForm(type){
        var deptCategory = $("#category_" + type + " option:selected").val();
        var deptName = $("#deptName_" + type + "").val();
        var fullName = $("#fullName_" + type + "").val();
        var parentId = $("#parentId_" + type + "").val();
        var remark = $("#remark_" + type + "").val();
        var sort = $("#sort_" + type + "").val();
        if(deptName == ""){
            alert("请填写机构名称");
            reutrn;
        }
        if(fullName == ""){
            alert("请填写机构全称");
            reutrn;
        }
        if(deptCategory == ""){
            alert("请选择机构类型");
            return;
        }
        if(sort == ""){
            alert("请填写排序");
            reutrn;
        }
        editObj.deptCategory = deptCategory;
        editObj.deptName = deptName;
        editObj.fullName = fullName;
        editObj.parentId = parentId;
        editObj.remark = remark;
        editObj.sort = sort;
        $request({
            url: requestUrl + '/dept/submit',
            method: 'post',
            data:JSON.stringify(editObj),
        },function(e){
            editObj = {};
            $("#deptName_" + type + "").val("");
            $("#fullName_" + type + "").val("");
            $("#parentId_" + type + "").val("");
            $("#remark" + type + "").val("");
            $("#sort" + type + "").val("");
            if(type==="edit"){
                $("#pop-juesebianji").fadeOut("normal");
            }else if(type == "add"){
                $("#pop-juesexinzeng").fadeOut("normal");
            }else if(type == "zx"){
                $("#pop-tianjiazx").fadeOut("normal");
            }
            $('.pop-bg').removeClass('open');
            getData(0);
        })
    }
    // 删除角色
    function deleteRole(num){
        var ids = removeList.join(",");
        if(num == 3){
            var idArr = [];
            $("input[name='datacheckbox']").each(function(i, n){
                if($(this).prop("checked")){
                    idArr.push($(this).val());
                }
            });
            if(idArr > 0){
                ids = idArr.join(",");
            }
        }
        if(ids == "" || ids.length === 0){
            alert("至少选择一条数据");
            $("#pop-shanchu"+num).fadeOut("normal");
            $('.pop-bg').removeClass('open');
            return;
        }
        $request({
            url: requestUrl + '/dept/remove',
            method: 'post',
            data: {
                ids: ids
            },
            contentType: 'application/x-www-form-urlencoded'
        },function(res){
            $("#pop-shanchu"+num).fadeOut("normal");
            $('.pop-bg').removeClass('open');
            getData(0);
        })
    }
    // 权限分配树
    function getGrantTree(){
        $request({
            url: requestUrl + '/menu/grant-tree',
            method: 'get',
        }, function(res) {
            $("input[name='checkbox']:checked").each(function (index, item) {
                getRoleTree($(item).val());
            });
            var menuTemplate = ''
            var dataTemplate = ''
            var apiTemplate = ''
            if(res.menu.length){
                $.each(res.menu, function(i, x){
                    menuTemplate += "<li>" +
                        "<div class='title'>" +
                        "<i onclick='switchTree(this)' class='el-icon-caret-right icon-calendar"+(x.hasChildren?' icon-plus-sign':'')+"'></i>" +
                        "<div class='checkbox-item'>" +
                        "<label>" +
                        "<input type='checkbox' name='menucheckbox' value="+x.id+" onclick='selectChecbox(this)'/>" +
                        "</label>" +
                        "</div>" +
                        "<span class='name'>"+x.title+"</span>" +
                        "</div>";
                    if(x.hasChildren){
                        menuTemplate = renderChildren(x.children,menuTemplate,'menu')
                    }
                    menuTemplate += "</li>";
                })
            }else{
                menuTemplate += "<div class='none-data'>" +
                    "<p>暂无数据</p>" +
                    "</div>"
            }
            if(res.dataScope.length){
                $.each(res.dataScope, function(i, x){
                    dataTemplate += "<li>" +
                        "<div class='title'>" +
                        "<i onclick='switchTree(this)' class='el-icon-caret-right icon-calendar"+(x.hasChildren?' icon-plus-sign':'')+"'></i>" +
                        "<div class='checkbox-item'>" +
                        "<label>" +
                        "<input type='checkbox' name='datacheckbox' value="+x.id+" onclick='selectChecbox(this)'/>" +
                        "</label>" +
                        "</div>" +
                        "<span class='name'>"+x.title+"</span>" +
                        "</div>";
                    if(x.hasChildren){
                        dataTemplate = renderChildren(x.children,dataTemplate,'data')
                    }
                    dataTemplate += "</li>";
                })
            }else{
                dataTemplate += "<div class='none-data'>" +
                    "<p>暂无数据</p>" +
                    "</div>"
            }
            if(res.apiScope.length){
                $.each(res.apiScope, function(i, x){
                    apiTemplate += "<li>" +
                        "<div class='title'>" +
                        "<i onclick='switchTree(this)' class='el-icon-caret-right icon-calendar"+(x.hasChildren?' icon-plus-sign':'')+"'></i>" +
                        "<div class='checkbox-item'>" +
                        "<label>" +
                        "<input type='checkbox' name='apicheckbox' value="+x.id+" onclick='selectChecbox(this)'/>" +
                        "</label>" +
                        "</div>" +
                        "<span class='name'>"+x.title+"</span>" +
                        "</div>";
                    if(x.hasChildren){
                        apiTemplate = renderChildren(x.children,apiTemplate,'api')
                    }
                    apiTemplate += "</li>";
                })
            }else{
                apiTemplate += "<div class='none-data'>" +
                    "<p>暂无数据</p>" +
                    "</div>"
            }
            console.log(menuTemplate)
            $('#menuScope').children().remove();
            $('#dataScope').children().remove();
            $('#apiScope').children().remove();
            $('#menuScope').append(menuTemplate)
            $('#dataScope').append(dataTemplate)
            $('#apiScope').append(apiTemplate)
        })
    }
    // 渲染子元素
    function renderChildren(children,template,type){
        template += "<ul>";
        $.each(children, function(i, item){
            template += "<li>" +
                "<div class='title'>" +
                "<i onclick='switchTree(this)' class='el-icon-caret-right icon-calendar"+(item.hasChildren?' icon-plus-sign':'')+"'></i>" +
                "<div class='checkbox-item'>" +
                "<label>" +
                "<input type='checkbox' name='"+type+"checkbox' value="+item.id+" onclick='selectChecbox(this)'/>" +
                "</label>" +
                "</div>" +
                "<span class='name'>"+item.title+"</span>" +
                "</div>";

            if(item.hasChildren){
                template=renderChildren(item.children,template,type)
            }
            template += "</li>";
        })
        template += "</ul>";
        return template
    }
    // 角色所分配的树
    function getRoleTree(roleIds){
        $request({
            url: requestUrl + '/menu/role-tree-keys?roleIds='+roleIds,
            method: 'get',
        }, function(res) {
            var apiScope=res.apiScope;
            var dataScope=res.dataScope;
            var menu=res.menu;
            $.each(apiScope, function(i, item){
                $("input[name='apicheckbox'][value="+item+"]").attr("checked",true);
                $("input[name='apicheckbox'][value="+item+"]").parent().addClass("formrel01-chk__checked");
            })
            $.each(dataScope, function(i, item){
                $("input[name='datacheckbox'][value="+item+"]").attr("checked",true);
                $("input[name='datacheckbox'][value="+item+"]").parent().addClass("formrel01-chk__checked");
            })
            $.each(menu, function(i, item){
                $("input[name='menucheckbox'][value="+item+"]").attr("checked",true);
                $("input[name='menucheckbox'][value="+item+"]").parent().addClass("formrel01-chk__checked");
            })
        })
    }
    // 提交权限设置
    function sumbitPermission(){
        var apiScopeIds=[];
        var dataScopeIds=[];
        var menuIds =[];
        var roleIds=[];
        $("input[name='apicheckbox']:checked").each(function (index, item) {
            apiScopeIds.push($(item).val());
        });
        $("input[name='datacheckbox']:checked").each(function (index, item) {
            dataScopeIds.push($(item).val());
        });
        $("input[name='menucheckbox']:checked").each(function (index, item) {
            menuIds.push($(item).val());
        });
        $("input[name='checkbox']:checked").each(function (index, item) {
            roleIds.push($(item).val());
        });
        var params={
            apiScopeIds: apiScopeIds,
            dataScopeIds: dataScopeIds,
            menuIds: menuIds,
            roleIds: roleIds
        }
        $request({
            url: requestUrl + '/role/grant',
            method: 'post',
            data:JSON.stringify(params),
        },function(e){
            $('#pop-quanxianshezhi').fadeOut("normal");
            $('.pop-bg').removeClass('open');
            getData(0);
        })
    }
    // 处理上级选择
    var editType = "";
    function zTreeOnClick(event, treeId, treeNode) {
        $("#parentId_" + editType + "").val(treeNode.id);
        $("#parentName_" + editType + "").val(treeNode.name);
    };
    var setting = {
        callback: {
            onClick: zTreeOnClick
        }
    };
    function initDeptTree(type){
        editType = type;
        $("#ztreeDiv_" + type + "").show();
        $request({
            url: requestUrl + '/dept/tree',
            method: 'get',
            data: {},
        },function(res){
            var nodes = JSON.stringify(res).replace(/title/g, "name");
            var nodeArr = JSON.parse(nodes);
            zTreeObj = $.fn.zTree.init($("#ztreeDiv_" + type + ""), setting, nodeArr);
        })
    }
    // 初始化页面请求
    selectgroup();
</script>
</body>

</html>